﻿
<MudStack>
    <MudText>Select an item</MudText>
    <MudToggleGroup T="string" SelectionMode="SelectionMode.SingleSelection" Value="_value1" ValueChanged="OnValueChanged" Color="Color.Primary" CheckMark FixedContent>
        <MudToggleItem Value="@("Yes")" Text="Yes" />
        <MudToggleItem Value="@("No")" Text="No" />
        <MudToggleItem Value="@("Don't know")" Text="Don't know (Click me twice)" />
    </MudToggleGroup>
    <MudText>
        Selected value : @(_value1 ?? "None")
    </MudText>
</MudStack>


@code {

    private string? _value1;

    private async Task OnValueChanged(string value)
    {
        if (value == "Don't know")
        {

            // I expect "Yes" to become the selected toggle button
            _value1 = "Yes";
        }
        else
        {
            _value1 = value;
        }

        await Task.CompletedTask;
    }
}